import { checkNameForm, ipz, portz, httpz } from "./formRuler";
// import rules from "./rules";
// isBoolean:true, // 是否为Boolean类型, 参数是否必须为boolen类型，不是根据options个数判断，是根据后台字段类型要求判断

const storageManageForm1 = [
  {
    value: "",
    type: "title",
    id: "",
    children: [
      {
        value: "",
        placeholder: "请输入",
        param: "ossName",
        rule: {
          required: true,
          validator: checkNameForm,
          trigger: ["blur"],
          msg1: "OSS名称不能为空",
          msg2: "OSS名称不能重复!",
          api: "fetchOssNameUnique",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "OSS名称:",
        beforeText: "",
        afterText: "",
        width: 492,
        showCount: true,
        maxCount: 25,
        marginLeft: 14,
        marginTop: 0,
        type: "textInput",
        associated: "",
        associatedValue: "",
      },
      {
        value: 1,
        placeholder: "请选择",
        param: "ossType",
        rule: {
          required: true,
          validator: checkNameForm,
          trigger: [""],
          message: "储存类型不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "储存类型:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        type: "multipleSelect",
        options: [
          { label: "腾讯云", value: 1 },
          { label: "阿里云", value: 2 },
          { label: "七牛云", value: 3 },
          { label: "MinIO", value: 4 },
          { label: "Aws", value: 5 },
        ],
        mode: "single",
        associated: "",
        associatedValue: "",
      },
      {
        value: "",
        placeholder: "请输入",
        param: "bucketName",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "Bucket名不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "Bucket名:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        width: 492,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "appId",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "AppId不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "AppId:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        width: 492,
        type: "textInput",
        associated: "ossType",
        associatedValue: 1,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "secretId",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "SecretId不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "SecretId:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        width: 492,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "bucketArea",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "地区码不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "地区码:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        width: 492,
        type: "textInput",
        associated: "ossType",
        associatedValue: "1,3,5",
      },

      {
        value: "",
        placeholder: "请输入",
        param: "endPoint",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "endPoint不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "endPoint:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        width: 492,
        type: "textInput",
        associated: "ossType",
        associatedValue: "2,4,5",
      },
      {
        value: "",
        placeholder: "请输入",
        param: "accessDomain",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "访问域名不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "访问域名:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        width: 492,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "appKey",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "appKey不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "appKey:",
        beforeText: "",
        afterText: "",
        marginLeft: 14,
        width: 492,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
    ],
  },
];
const storageManageForm2 = [
  {
    value: "",
    type: "title",
    id: "",
    children: [
      {
        value: "",
        placeholder: "请输入",
        param: "ftpName",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          msg1: "1111",
          msg2: "",
          id: "",
          message: "FTP名称不能为空",
          api: "fetchFtpNameUnique",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "FTP名称:",
        beforeText: "",
        afterText: "",
        width: 480,
        showCount: true,
        maxCount: 25,
        marginLeft: 0,
        marginTop: 0,
        type: "textInput",
        associated: "",
        associatedValue: "",
      },
      {
        value: "",
        placeholder: "请输入",
        param: "ip",
        rule: {
          required: true,
          validator: ipz,
          trigger: ["blur"],
          // message: "服务器IP不能为空",
          msg1: "服务器IP不能为空",
          msg2: "请输入正确的IP",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "服务器IP:",
        beforeText: "",
        afterText: "",
        marginLeft: 0,
        width: 480,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "port",
        rule: {
          required: true,
          validator: portz,
          trigger: ["blur"],
          // message: "端口号不能为空",
          msg1: "端口号不能为空",
          msg2: "请输入合法数字",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "端口号:",
        beforeText: "",
        afterText: "",
        marginLeft: 0,
        width: 480,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "ftpPath",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "远程目录不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "远程目录:",
        beforeText: "",
        afterText: "",
        marginLeft: 0,
        width: 480,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "username",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "登录名不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "登录名:",
        beforeText: "",
        afterText: "",
        marginLeft: 0,
        width: 480,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "password",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "密码不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "密码:",
        beforeText: "",
        afterText: "",
        marginLeft: 0,
        width: 480,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "请输入",
        param: "encoding",
        rule: {
          required: true,
          // validator: checkNameForm,
          trigger: ["blur"],
          message: "编码不能为空",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "编码:",
        beforeText: "",
        afterText: "",
        marginLeft: 0,
        width: 480,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
      {
        value: "",
        placeholder: "域名必须是http或https协议",
        param: "url",
        rule: {
          required: true,
          validator: httpz,
          trigger: ["blur"],
          // message: "资源访问域名不能为空",
          msg1: "资源访问域名不能为空",
          msg2: "域名必须是http或https协议",
          api: "",
          key: "siteDomain",
          params: {}, //校验传参
        },
        label: "资源访问域名:",
        beforeText: "",
        afterText: "",
        marginLeft: 0,
        width: 480,
        type: "textInput",
        associated: "",
        associatedValue: true,
      },
    ],
  },
];
export { storageManageForm1, storageManageForm2 };
